import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import Child from './components/Child'

// 匈牙利命名法：类型 + 名字（意思）
// b => Boolean => bBar
// i => iNum =>
// const aDiv = document.querySelectorAll('div')
// const oDiv = document.querySelector('div')
// o => object

export default class App extends Component {
  state = {
    bBar: true,
  }
  handleClick = () => {
    // 卸载的触发时机
    this.setState({ bBar: !this.state.bBar })
    // ReactDOM.unmountComponentAtNode(document.querySelector('#root'))
  }
  render() {
    return (
      <div>
        App
        <button onClick={this.handleClick}>修改bBar</button>
        <hr />
        {this.state.bBar && <Child />}
      </div>
    )
  }
}
